package com.wangsd.web.coupon.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wangsd.common.exception.BusinessException;
import com.wangsd.web.coupon.entity.BusinessCoupon;
import com.baomidou.mybatisplus.extension.service.IService;

import java.io.IOException;
import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author generator
 * @since 2020-01-07
 */
public interface BusinessCouponService extends IService<BusinessCoupon> {
    /**
     * 添加优惠券
     */
    void add(BusinessCoupon entity) throws BusinessException, IOException;

    /**
     * 查询优惠券列表数据
     */
    IPage<BusinessCoupon> selectPage(String code, Integer pageNum, Integer pageSize, BusinessCoupon businessCoupon);

    /**
     * 通过商家券批次名称查询优惠券是否重复
     */
    BusinessCoupon selectRepeat(String stockName, Long id);

    /**
     * 核销商家券
     */
    void useBusinessCoupon(String couponCode,String storeCode) throws BusinessException,IOException ;

    /**
     * 上架下架
     */
    int updateState(BusinessCoupon businessCoupon);

    /**
     * 查询所有的商家券
     */
    List<BusinessCoupon> selectAll(BusinessCoupon businessCoupon);
}
